package yl.hs.bmipfull.controllers.finance;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import yl.hs.bmipfull.controllers.ControllerBase;
import yl.hs.bmipfull.service.finance.IContractAccountService;
import yl.hs.bmipfull.viewmodels.PageQuery;
import yl.hs.bmipfull.viewmodels.WebResult;

/**
 * @author 张凯
 * @apiNote 合同台帐信息-Controller
 * @since 2022/1/11 5:16 下午 创建
 */
@RequestMapping("/api/finance/account")
@Api(value = "销售合同台帐Web接口", tags = "财务管理——销售合同台帐信息")
@RestController
public class ContractAccountController extends ControllerBase {

    @PostMapping("/{rowNum}/{page}")
    @ApiOperation(value = "查询合同台帐信息", notes = "分页查询合同台帐信息" )
    public WebResult queryPage(@ApiParam(value = "查询") @RequestBody PageQuery query, @PathVariable Integer page, @PathVariable Integer rowNum){
        try {
            var list = contractAccountService.queryHfList(query, page, rowNum);
            return success("ok",list);
        } catch (Exception e) {
            return error(e);
        }
    }

    @Autowired
    public void setContractAccountService(IContractAccountService contractAccountService) {
        this.contractAccountService = contractAccountService;
    }

    IContractAccountService contractAccountService;
}
